import { ComponentType } from './types/index';

/**
 * @description: 生成placeholder
 */
export function createPlaceholderMessage(component: ComponentType) {
  if (component === 'AInput') return '请输入';
  if (['ASelect', 'ACheckbox', 'ARadio', 'ASwitch', 'ADatePicker', 'ATimePicker'].includes( component)) return '请选择';
  return '';
}

const DATE_TYPE = ['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'];

function genType() {
  return [...DATE_TYPE, 'RangePicker'];
}

/**
 * 时间字段
 */
export const dateItemType = genType();

export function defaultType(component: string | any) {
  if (component === 'AInput') return '';
  if (component === 'AInputNumber') return null;
  return [
    'ASelect',
    'ACheckbox',
    'ARadio',
    'ASwitch',
    'ADatePicker',
    'ATimePicker',
  ].includes(component)
    ? ''
    : undefined;
}
